package com.onpositive.image.fitting.tools;

import java.awt.Rectangle;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;

import com.onpositive.image.factories.AbstractImageFitter;
import com.onpositive.image.fitting.tools.TransformerFactory.TransformParam;

public class BasicImageFitter extends AbstractImageFitter {
	
	@Override
	public BufferedImage doFitImage(BufferedImage source, Rectangle destRect) {
		
		TransformParam tp = TransformerFactory.getInstance().createRoughResizeParam(source, destRect, 1 ) ;
		BufferedImage result = new BufferedImage( tp.getDstWidth(), tp.getDstHeight(), source.getType() ) ;
		tp.getTransformOp().filter( source, result ) ;
		
		return result;
	}

}
